package com.example.ythhome.system.api;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.ythhome.login.entity.RequestData;
import com.example.ythhome.login.entity.ResponseData;
import com.example.ythhome.login.entity.Role;
import com.example.ythhome.system.entity.SysDict;
import com.example.ythhome.system.service.SysDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("api/system/dict")
public class SysDictController {

    @Autowired
    SysDictService sysDictService;

    @GetMapping("/query/{typeCode}")
    @ResponseBody
    public ResponseData<List> login(@PathVariable("typeCode") String typeCode) {
        QueryWrapper<SysDict> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("type_code", typeCode).orderByAsc("sort_order");
        return new ResponseData<List>(ResponseData.StatusCodeEnum_SUCCESS, sysDictService.list(queryWrapper));
    }
}
